<?php
declare(strict_types=1);
namespace Field;

class QuestionThreadTopConst
{
    public const pk='';
    public const index=['CateID','ThreadID'];
	public const fields=['CateID','ThreadID'];
	public const comment=['CateID'=>'','ThreadID'=>''];
	/*
    * @Field CateID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CateID = 'CateID';
    /*
    * @Field ThreadID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const ThreadID = 'ThreadID';
}

class QuestionThreadTopColumns
{
public  int $CateID;
   public  int $ThreadID;
	public function toArray():array
	{
		return [
'CateID'=>$this->CateID,
    'ThreadID'=>$this->ThreadID,        ];
	}
}

class QuestionThreadTopRow
{
	public QuestionThreadTopColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'CateID' => $this->data->CateID,
        'ThreadID' => $this->data->ThreadID, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new QuestionThreadTopColumns();
        isset($data['CateID']) && $this->data->CateID = (int)$data['CateID'];
           isset($data['ThreadID']) && $this->data->ThreadID = (int)$data['ThreadID'];
    }
}
?>